package com.lone.smallmovie.service.impl;

import com.lone.smallmovie.controller.UserController;
import com.lone.smallmovie.dao.UserDao;
import com.lone.smallmovie.model.User;
import com.lone.smallmovie.service.UserService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    private Logger log = Logger.getLogger(UserController.class);

    @Autowired
    private UserDao userDao;

    public User login(String userAccount, String password) {
        return  userDao.login(userAccount,password);
    }

    public User queryUserByUserAccount(String userAccount) {
        return userDao.queryUserByUserAccount(userAccount);
    }

    public int registered(String userId, String userAccount, String password) {
        log.info("=============   "+userAccount+"          "+password);

       return userDao.registered(userId,userAccount,password);
    }

    public int updateNickName(String nickName,String userAccount) {
        return userDao.updateNickNameByUserAccount(nickName,userAccount);
    }

    public int changeLoginPasswordByUserAccount(String userAccount,String loginPassword) {
        return userDao.changeLoginPasswordByUserAccount(userAccount,loginPassword);
    }
}
